package com.meida.module.bus.provider.service.impl;

import com.meida.common.base.entity.EntityMap;
import com.meida.common.mybatis.base.service.impl.BaseServiceImpl;
import com.meida.common.mybatis.model.ResultBody;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.common.mybatis.query.CriteriaSave;
import com.meida.module.bus.client.entity.BusInternationalCode;
import com.meida.module.bus.provider.mapper.BusInternationalCodeMapper;
import com.meida.module.bus.provider.service.BusInternationalCodeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 国际区号表（新增表）接口实现类
 *
 * @author flyme
 * @date 2021-08-07
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class BusInternationalCodeServiceImpl extends BaseServiceImpl<BusInternationalCodeMapper, BusInternationalCode> implements BusInternationalCodeService {

    @Override
    public ResultBody beforeAdd(CriteriaSave cs, BusInternationalCode bic, EntityMap extra) {
        return ResultBody.ok();
    }


    @Override
    @Transactional(propagation = Propagation.NOT_SUPPORTED, readOnly = true)
    public ResultBody beforePageList(CriteriaQuery<BusInternationalCode> cq, BusInternationalCode bic, EntityMap requestMap) {
        cq.like(BusInternationalCode.class, "internationaNo");
        cq.like(BusInternationalCode.class, "internationaName");
        cq.orderByAsc("internationalCode.sort");
        return ResultBody.ok();
    }
}
